import React, { Component } from 'react'
import { Router, Route, Redirect, Switch } from 'react-router-dom'
import Login from './pages/Login'
import Layout from './pages/layout'
import AuthRoute from 'components/AuthRoute'
import history from 'utils/history'

export default class App extends Component {
  render() {
    return (
      <Router history={history}>
        <Switch>
          <Route
            exact
            path="/"
            render={() => {
              return <Redirect to="/home" />
            }}
          ></Route>
          <Route path="/login" component={Login}></Route>
          <AuthRoute path="/home" component={Layout}></AuthRoute>
        </Switch>
      </Router>
    )
  }
}
